// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.

#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![no_implicit_prelude]
extern crate async_trait;
extern crate bytes;
extern crate gax;
extern crate gaxi;
extern crate gtype;
extern crate lazy_static;
extern crate longrunning;
extern crate lro;
extern crate reqwest;
extern crate serde;
extern crate serde_json;
extern crate serde_with;
extern crate std;
extern crate tracing;
extern crate wkt;

mod debug;
mod deserialize;
mod serialize;

/// The `Registration` resource facilitates managing and configuring domain name
/// registrations.
///
/// There are several ways to create a new `Registration` resource:
///
/// To create a new `Registration` resource, find a suitable domain name by
/// calling the `SearchDomains` method with a query to see available domain name
/// options. After choosing a name, call `RetrieveRegisterParameters` to
/// ensure availability and obtain information like pricing, which is needed to
/// build a call to `RegisterDomain`.
///
/// Another way to create a new `Registration` is to transfer an existing
/// domain from another registrar. First, go to the current registrar to unlock
/// the domain for transfer and retrieve the domain's transfer authorization
/// code. Then call `RetrieveTransferParameters` to confirm that the domain is
/// unlocked and to get values needed to build a call to `TransferDomain`.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Registration {
    /// Output only. Name of the `Registration` resource, in the format
    /// `projects/*/locations/*/registrations/<domain_name>`.
    pub name: std::string::String,

    /// Required. Immutable. The domain name. Unicode domain names must be expressed in Punycode format.
    pub domain_name: std::string::String,

    /// Output only. The creation timestamp of the `Registration` resource.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The expiration timestamp of the `Registration`.
    pub expire_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The state of the `Registration`
    pub state: crate::model::registration::State,

    /// Output only. The set of issues with the `Registration` that require attention.
    pub issues: std::vec::Vec<crate::model::registration::Issue>,

    /// Set of labels associated with the `Registration`.
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    /// Settings for management of the `Registration`, including renewal, billing,
    /// and transfer. You cannot update these with the `UpdateRegistration`
    /// method. To update these settings, use the `ConfigureManagementSettings`
    /// method.
    pub management_settings: std::option::Option<crate::model::ManagementSettings>,

    /// Settings controlling the DNS configuration of the `Registration`. You
    /// cannot update these with the `UpdateRegistration` method. To update these
    /// settings, use the `ConfigureDnsSettings` method.
    pub dns_settings: std::option::Option<crate::model::DnsSettings>,

    /// Required. Settings for contact information linked to the `Registration`. You cannot
    /// update these with the `UpdateRegistration` method. To update these
    /// settings, use the `ConfigureContactSettings` method.
    pub contact_settings: std::option::Option<crate::model::ContactSettings>,

    /// Output only. Pending contact settings for the `Registration`. Updates to the
    /// `contact_settings` field that change its `registrant_contact` or `privacy`
    /// fields require email confirmation by the `registrant_contact`
    /// before taking effect. This field is set only if there are pending updates
    /// to the `contact_settings` that have not been confirmed. To confirm the
    /// changes, the `registrant_contact` must follow the instructions in the
    /// email they receive.
    pub pending_contact_settings: std::option::Option<crate::model::ContactSettings>,

    /// Output only. Set of options for the `contact_settings.privacy` field that this
    /// `Registration` supports.
    pub supported_privacy: std::vec::Vec<crate::model::ContactPrivacy>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Registration {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::Registration::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [domain_name][crate::model::Registration::domain_name].
    pub fn set_domain_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.domain_name = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::Registration::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::Registration::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [expire_time][crate::model::Registration::expire_time].
    pub fn set_expire_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.expire_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [expire_time][crate::model::Registration::expire_time].
    pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.expire_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [state][crate::model::Registration::state].
    pub fn set_state<T: std::convert::Into<crate::model::registration::State>>(
        mut self,
        v: T,
    ) -> Self {
        self.state = v.into();
        self
    }

    /// Sets the value of [issues][crate::model::Registration::issues].
    pub fn set_issues<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::registration::Issue>,
    {
        use std::iter::Iterator;
        self.issues = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [labels][crate::model::Registration::labels].
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [management_settings][crate::model::Registration::management_settings].
    pub fn set_management_settings<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ManagementSettings>,
    {
        self.management_settings = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [management_settings][crate::model::Registration::management_settings].
    pub fn set_or_clear_management_settings<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ManagementSettings>,
    {
        self.management_settings = v.map(|x| x.into());
        self
    }

    /// Sets the value of [dns_settings][crate::model::Registration::dns_settings].
    pub fn set_dns_settings<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::DnsSettings>,
    {
        self.dns_settings = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [dns_settings][crate::model::Registration::dns_settings].
    pub fn set_or_clear_dns_settings<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::DnsSettings>,
    {
        self.dns_settings = v.map(|x| x.into());
        self
    }

    /// Sets the value of [contact_settings][crate::model::Registration::contact_settings].
    pub fn set_contact_settings<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ContactSettings>,
    {
        self.contact_settings = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [contact_settings][crate::model::Registration::contact_settings].
    pub fn set_or_clear_contact_settings<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ContactSettings>,
    {
        self.contact_settings = v.map(|x| x.into());
        self
    }

    /// Sets the value of [pending_contact_settings][crate::model::Registration::pending_contact_settings].
    pub fn set_pending_contact_settings<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ContactSettings>,
    {
        self.pending_contact_settings = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [pending_contact_settings][crate::model::Registration::pending_contact_settings].
    pub fn set_or_clear_pending_contact_settings<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ContactSettings>,
    {
        self.pending_contact_settings = v.map(|x| x.into());
        self
    }

    /// Sets the value of [supported_privacy][crate::model::Registration::supported_privacy].
    pub fn set_supported_privacy<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::ContactPrivacy>,
    {
        use std::iter::Iterator;
        self.supported_privacy = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for Registration {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.domains.v1.Registration"
    }
}

/// Defines additional types related to [Registration].
pub mod registration {
    #[allow(unused_imports)]
    use super::*;

    /// Possible states of a `Registration`.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum State {
        /// The state is undefined.
        Unspecified,
        /// The domain is being registered.
        RegistrationPending,
        /// The domain registration failed. You can delete resources in this state
        /// to allow registration to be retried.
        RegistrationFailed,
        /// The domain is being transferred from another registrar to Cloud Domains.
        TransferPending,
        /// The attempt to transfer the domain from another registrar to
        /// Cloud Domains failed. You can delete resources in this state and retry
        /// the transfer.
        TransferFailed,
        /// The domain is registered and operational. The domain renews automatically
        /// as long as it remains in this state.
        Active,
        /// The domain is suspended and inoperative. For more details, see the
        /// `issues` field.
        Suspended,
        /// The domain is no longer managed with Cloud Domains. It may have been
        /// transferred to another registrar or exported for management in
        /// [Google Domains](https://domains.google/). You can no longer update it
        /// with this API, and information shown about it may be stale. Domains in
        /// this state are not automatically renewed by Cloud Domains.
        Exported,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [State::value] or
        /// [State::name].
        UnknownValue(state::UnknownValue),
    }

    #[doc(hidden)]
    pub mod state {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl State {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::RegistrationPending => std::option::Option::Some(1),
                Self::RegistrationFailed => std::option::Option::Some(2),
                Self::TransferPending => std::option::Option::Some(3),
                Self::TransferFailed => std::option::Option::Some(4),
                Self::Active => std::option::Option::Some(6),
                Self::Suspended => std::option::Option::Some(7),
                Self::Exported => std::option::Option::Some(8),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
                Self::RegistrationPending => std::option::Option::Some("REGISTRATION_PENDING"),
                Self::RegistrationFailed => std::option::Option::Some("REGISTRATION_FAILED"),
                Self::TransferPending => std::option::Option::Some("TRANSFER_PENDING"),
                Self::TransferFailed => std::option::Option::Some("TRANSFER_FAILED"),
                Self::Active => std::option::Option::Some("ACTIVE"),
                Self::Suspended => std::option::Option::Some("SUSPENDED"),
                Self::Exported => std::option::Option::Some("EXPORTED"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for State {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for State {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for State {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::RegistrationPending,
                2 => Self::RegistrationFailed,
                3 => Self::TransferPending,
                4 => Self::TransferFailed,
                6 => Self::Active,
                7 => Self::Suspended,
                8 => Self::Exported,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for State {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "STATE_UNSPECIFIED" => Self::Unspecified,
                "REGISTRATION_PENDING" => Self::RegistrationPending,
                "REGISTRATION_FAILED" => Self::RegistrationFailed,
                "TRANSFER_PENDING" => Self::TransferPending,
                "TRANSFER_FAILED" => Self::TransferFailed,
                "ACTIVE" => Self::Active,
                "SUSPENDED" => Self::Suspended,
                "EXPORTED" => Self::Exported,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for State {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::RegistrationPending => serializer.serialize_i32(1),
                Self::RegistrationFailed => serializer.serialize_i32(2),
                Self::TransferPending => serializer.serialize_i32(3),
                Self::TransferFailed => serializer.serialize_i32(4),
                Self::Active => serializer.serialize_i32(6),
                Self::Suspended => serializer.serialize_i32(7),
                Self::Exported => serializer.serialize_i32(8),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for State {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
                ".google.cloud.domains.v1.Registration.State",
            ))
        }
    }

    /// Possible issues with a `Registration` that require attention.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Issue {
        /// The issue is undefined.
        Unspecified,
        /// Contact the Cloud Support team to resolve a problem with this domain.
        ContactSupport,
        /// [ICANN](https://icann.org/) requires verification of the email address
        /// in the `Registration`'s `contact_settings.registrant_contact` field. To
        /// verify the email address, follow the
        /// instructions in the email the `registrant_contact` receives following
        /// registration. If you do not complete email verification within
        /// 15 days of registration, the domain is suspended. To resend the
        /// verification email, call ConfigureContactSettings and provide the current
        /// `registrant_contact.email`.
        UnverifiedEmail,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [Issue::value] or
        /// [Issue::name].
        UnknownValue(issue::UnknownValue),
    }

    #[doc(hidden)]
    pub mod issue {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl Issue {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::ContactSupport => std::option::Option::Some(1),
                Self::UnverifiedEmail => std::option::Option::Some(2),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("ISSUE_UNSPECIFIED"),
                Self::ContactSupport => std::option::Option::Some("CONTACT_SUPPORT"),
                Self::UnverifiedEmail => std::option::Option::Some("UNVERIFIED_EMAIL"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for Issue {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for Issue {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for Issue {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::ContactSupport,
                2 => Self::UnverifiedEmail,
                _ => Self::UnknownValue(issue::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for Issue {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "ISSUE_UNSPECIFIED" => Self::Unspecified,
                "CONTACT_SUPPORT" => Self::ContactSupport,
                "UNVERIFIED_EMAIL" => Self::UnverifiedEmail,
                _ => Self::UnknownValue(issue::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for Issue {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::ContactSupport => serializer.serialize_i32(1),
                Self::UnverifiedEmail => serializer.serialize_i32(2),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for Issue {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Issue>::new(
                ".google.cloud.domains.v1.Registration.Issue",
            ))
        }
    }
}

/// Defines renewal, billing, and transfer settings for a `Registration`.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ManagementSettings {
    /// Output only. The renewal method for this `Registration`.
    pub renewal_method: crate::model::management_settings::RenewalMethod,

    /// Controls whether the domain can be transferred to another registrar.
    pub transfer_lock_state: crate::model::TransferLockState,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ManagementSettings {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [renewal_method][crate::model::ManagementSettings::renewal_method].
    pub fn set_renewal_method<
        T: std::convert::Into<crate::model::management_settings::RenewalMethod>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.renewal_method = v.into();
        self
    }

    /// Sets the value of [transfer_lock_state][crate::model::ManagementSettings::transfer_lock_state].
    pub fn set_transfer_lock_state<T: std::convert::Into<crate::model::TransferLockState>>(
        mut self,
        v: T,
    ) -> Self {
        self.transfer_lock_state = v.into();
        self
    }
}

impl wkt::message::Message for ManagementSettings {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.domains.v1.ManagementSettings"
    }
}

/// Defines additional types related to [ManagementSettings].
pub mod management_settings {
    #[allow(unused_imports)]
    use super::*;

    /// Defines how the `Registration` is renewed.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum RenewalMethod {
        /// The renewal method is undefined.
        Unspecified,
        /// The domain is automatically renewed each year .
        ///
        /// To disable automatic renewals, delete the resource by calling
        /// `DeleteRegistration` or export it by calling `ExportRegistration`.
        AutomaticRenewal,
        /// The domain must be explicitly renewed each year before its
        /// `expire_time`. This option is only available when the `Registration`
        /// is in state `EXPORTED`.
        ///
        /// To manage the domain's current billing and
        /// renewal settings, go to [Google Domains](https://domains.google/).
        ManualRenewal,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [RenewalMethod::value] or
        /// [RenewalMethod::name].
        UnknownValue(renewal_method::UnknownValue),
    }

    #[doc(hidden)]
    pub mod renewal_method {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl RenewalMethod {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::AutomaticRenewal => std::option::Option::Some(1),
                Self::ManualRenewal => std::option::Option::Some(2),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("RENEWAL_METHOD_UNSPECIFIED"),
                Self::AutomaticRenewal => std::option::Option::Some("AUTOMATIC_RENEWAL"),
                Self::ManualRenewal => std::option::Option::Some("MANUAL_RENEWAL"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for RenewalMethod {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for RenewalMethod {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for RenewalMethod {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::AutomaticRenewal,
                2 => Self::ManualRenewal,
                _ => Self::UnknownValue(renewal_method::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for RenewalMethod {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "RENEWAL_METHOD_UNSPECIFIED" => Self::Unspecified,
                "AUTOMATIC_RENEWAL" => Self::AutomaticRenewal,
                "MANUAL_RENEWAL" => Self::ManualRenewal,
                _ => Self::UnknownValue(renewal_method::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for RenewalMethod {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::AutomaticRenewal => serializer.serialize_i32(1),
                Self::ManualRenewal => serializer.serialize_i32(2),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for RenewalMethod {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<RenewalMethod>::new(
                ".google.cloud.domains.v1.ManagementSettings.RenewalMethod",
            ))
        }
    }
}

/// Defines the DNS configuration of a `Registration`, including name servers,
/// DNSSEC, and glue records.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DnsSettings {
    /// The list of glue records for this `Registration`. Commonly empty.
    pub glue_records: std::vec::Vec<crate::model::dns_settings::GlueRecord>,

    /// The DNS provider of the registration.
    pub dns_provider: std::option::Option<crate::model::dns_settings::DnsProvider>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DnsSettings {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [glue_records][crate::model::DnsSettings::glue_records].
    pub fn set_glue_records<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::dns_settings::GlueRecord>,
    {
        use std::iter::Iterator;
        self.glue_records = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [dns_provider][crate::model::DnsSettings::dns_provider].
    ///
    /// Note that all the setters affecting `dns_provider` are mutually
    /// exclusive.
    pub fn set_dns_provider<
        T: std::convert::Into<std::option::Option<crate::model::dns_settings::DnsProvider>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.dns_provider = v.into();
        self
    }

    /// The value of [dns_provider][crate::model::DnsSettings::dns_provider]
    /// if it holds a `CustomDns`, `None` if the field is not set or
    /// holds a different branch.
    pub fn custom_dns(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::dns_settings::CustomDns>> {
        #[allow(unreachable_patterns)]
        self.dns_provider.as_ref().and_then(|v| match v {
            crate::model::dns_settings::DnsProvider::CustomDns(v) => std::option::Option::Some(v),
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [dns_provider][crate::model::DnsSettings::dns_provider]
    /// to hold a `CustomDns`.
    ///
    /// Note that all the setters affecting `dns_provider` are
    /// mutually exclusive.
    pub fn set_custom_dns<
        T: std::convert::Into<std::boxed::Box<crate::model::dns_settings::CustomDns>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.dns_provider =
            std::option::Option::Some(crate::model::dns_settings::DnsProvider::CustomDns(v.into()));
        self
    }

    /// The value of [dns_provider][crate::model::DnsSettings::dns_provider]
    /// if it holds a `GoogleDomainsDns`, `None` if the field is not set or
    /// holds a different branch.
    pub fn google_domains_dns(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::dns_settings::GoogleDomainsDns>> {
        #[allow(unreachable_patterns)]
        self.dns_provider.as_ref().and_then(|v| match v {
            crate::model::dns_settings::DnsProvider::GoogleDomainsDns(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [dns_provider][crate::model::DnsSettings::dns_provider]
    /// to hold a `GoogleDomainsDns`.
    ///
    /// Note that all the setters affecting `dns_provider` are
    /// mutually exclusive.
    pub fn set_google_domains_dns<
        T: std::convert::Into<std::boxed::Box<crate::model::dns_settings::GoogleDomainsDns>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.dns_provider = std::option::Option::Some(
            crate::model::dns_settings::DnsProvider::GoogleDomainsDns(v.into()),
        );
        self
    }
}

impl wkt::message::Message for DnsSettings {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.domains.v1.DnsSettings"
    }
}

/// Defines additional types related to [DnsSettings].
pub mod dns_settings {
    #[allow(unused_imports)]
    use super::*;

    /// Configuration for an arbitrary DNS provider.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct CustomDns {
        /// Required. A list of name servers that store the DNS zone for this domain. Each name
        /// server is a domain name, with Unicode domain names expressed in
        /// Punycode format.
        pub name_servers: std::vec::Vec<std::string::String>,

        /// The list of DS records for this domain, which are used to enable DNSSEC.
        /// The domain's DNS provider can provide the values to set here. If this
        /// field is empty, DNSSEC is disabled.
        pub ds_records: std::vec::Vec<crate::model::dns_settings::DsRecord>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl CustomDns {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [name_servers][crate::model::dns_settings::CustomDns::name_servers].
        pub fn set_name_servers<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<std::string::String>,
        {
            use std::iter::Iterator;
            self.name_servers = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [ds_records][crate::model::dns_settings::CustomDns::ds_records].
        pub fn set_ds_records<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::dns_settings::DsRecord>,
        {
            use std::iter::Iterator;
            self.ds_records = v.into_iter().map(|i| i.into()).collect();
            self
        }
    }

    impl wkt::message::Message for CustomDns {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.domains.v1.DnsSettings.CustomDns"
        }
    }

    /// Configuration for using the free DNS zone provided by Google Domains as a
    /// `Registration`'s `dns_provider`. You cannot configure the DNS zone itself
    /// using the API. To configure the DNS zone, go to
    /// [Google Domains](https://domains.google/).
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct GoogleDomainsDns {
        /// Output only. A list of name servers that store the DNS zone for this domain. Each name
        /// server is a domain name, with Unicode domain names expressed in
        /// Punycode format. This field is automatically populated with the name
        /// servers assigned to the Google Domains DNS zone.
        pub name_servers: std::vec::Vec<std::string::String>,

        /// Required. The state of DS records for this domain. Used to enable or disable
        /// automatic DNSSEC.
        pub ds_state: crate::model::dns_settings::DsState,

        /// Output only. The list of DS records published for this domain. The list is
        /// automatically populated when `ds_state` is `DS_RECORDS_PUBLISHED`,
        /// otherwise it remains empty.
        pub ds_records: std::vec::Vec<crate::model::dns_settings::DsRecord>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl GoogleDomainsDns {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [name_servers][crate::model::dns_settings::GoogleDomainsDns::name_servers].
        pub fn set_name_servers<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<std::string::String>,
        {
            use std::iter::Iterator;
            self.name_servers = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [ds_state][crate::model::dns_settings::GoogleDomainsDns::ds_state].
        pub fn set_ds_state<T: std::convert::Into<crate::model::dns_settings::DsState>>(
            mut self,
            v: T,
        ) -> Self {
            self.ds_state = v.into();
            self
        }

        /// Sets the value of [ds_records][crate::model::dns_settings::GoogleDomainsDns::ds_records].
        pub fn set_ds_records<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::dns_settings::DsRecord>,
        {
            use std::iter::Iterator;
            self.ds_records = v.into_iter().map(|i| i.into()).collect();
            self
        }
    }

    impl wkt::message::Message for GoogleDomainsDns {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.domains.v1.DnsSettings.GoogleDomainsDns"
        }
    }

    /// Defines a Delegation Signer (DS) record, which is needed to enable DNSSEC
    /// for a domain. It contains a digest (hash) of a DNSKEY record that must be
    /// present in the domain's DNS zone.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct DsRecord {
        /// The key tag of the record. Must be set in range 0 -- 65535.
        pub key_tag: i32,

        /// The algorithm used to generate the referenced DNSKEY.
        pub algorithm: crate::model::dns_settings::ds_record::Algorithm,

        /// The hash function used to generate the digest of the referenced DNSKEY.
        pub digest_type: crate::model::dns_settings::ds_record::DigestType,

        /// The digest generated from the referenced DNSKEY.
        pub digest: std::string::String,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl DsRecord {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [key_tag][crate::model::dns_settings::DsRecord::key_tag].
        pub fn set_key_tag<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
            self.key_tag = v.into();
            self
        }

        /// Sets the value of [algorithm][crate::model::dns_settings::DsRecord::algorithm].
        pub fn set_algorithm<
            T: std::convert::Into<crate::model::dns_settings::ds_record::Algorithm>,
        >(
            mut self,
            v: T,
        ) -> Self {
            self.algorithm = v.into();
            self
        }

        /// Sets the value of [digest_type][crate::model::dns_settings::DsRecord::digest_type].
        pub fn set_digest_type<
            T: std::convert::Into<crate::model::dns_settings::ds_record::DigestType>,
        >(
            mut self,
            v: T,
        ) -> Self {
            self.digest_type = v.into();
            self
        }

        /// Sets the value of [digest][crate::model::dns_settings::DsRecord::digest].
        pub fn set_digest<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.digest = v.into();
            self
        }
    }

    impl wkt::message::Message for DsRecord {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.domains.v1.DnsSettings.DsRecord"
        }
    }

    /// Defines additional types related to [DsRecord].
    pub mod ds_record {
        #[allow(unused_imports)]
        use super::*;

        /// List of algorithms used to create a DNSKEY. Certain
        /// algorithms are not supported for particular domains.
        ///
        /// # Working with unknown values
        ///
        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
        /// additional enum variants at any time. Adding new variants is not considered
        /// a breaking change. Applications should write their code in anticipation of:
        ///
        /// - New values appearing in future releases of the client library, **and**
        /// - New values received dynamically, without application changes.
        ///
        /// Please consult the [Working with enums] section in the user guide for some
        /// guidelines.
        ///
        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
        #[derive(Clone, Debug, PartialEq)]
        #[non_exhaustive]
        pub enum Algorithm {
            /// The algorithm is unspecified.
            Unspecified,
            /// RSA/MD5. Cannot be used for new deployments.
            Rsamd5,
            /// Diffie-Hellman. Cannot be used for new deployments.
            Dh,
            /// DSA/SHA1. Not recommended for new deployments.
            Dsa,
            /// ECC. Not recommended for new deployments.
            Ecc,
            /// RSA/SHA-1. Not recommended for new deployments.
            Rsasha1,
            /// DSA-NSEC3-SHA1. Not recommended for new deployments.
            Dsansec3Sha1,
            /// RSA/SHA1-NSEC3-SHA1. Not recommended for new deployments.
            Rsasha1Nsec3Sha1,
            /// RSA/SHA-256.
            Rsasha256,
            /// RSA/SHA-512.
            Rsasha512,
            /// GOST R 34.10-2001.
            Eccgost,
            /// ECDSA Curve P-256 with SHA-256.
            Ecdsap256Sha256,
            /// ECDSA Curve P-384 with SHA-384.
            Ecdsap384Sha384,
            /// Ed25519.
            Ed25519,
            /// Ed448.
            Ed448,
            /// Reserved for Indirect Keys. Cannot be used for new deployments.
            Indirect,
            /// Private algorithm. Cannot be used for new deployments.
            Privatedns,
            /// Private algorithm OID. Cannot be used for new deployments.
            Privateoid,
            /// If set, the enum was initialized with an unknown value.
            ///
            /// Applications can examine the value using [Algorithm::value] or
            /// [Algorithm::name].
            UnknownValue(algorithm::UnknownValue),
        }

        #[doc(hidden)]
        pub mod algorithm {
            #[allow(unused_imports)]
            use super::*;
            #[derive(Clone, Debug, PartialEq)]
            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
        }

        impl Algorithm {
            /// Gets the enum value.
            ///
            /// Returns `None` if the enum contains an unknown value deserialized from
            /// the string representation of enums.
            pub fn value(&self) -> std::option::Option<i32> {
                match self {
                    Self::Unspecified => std::option::Option::Some(0),
                    Self::Rsamd5 => std::option::Option::Some(1),
                    Self::Dh => std::option::Option::Some(2),
                    Self::Dsa => std::option::Option::Some(3),
                    Self::Ecc => std::option::Option::Some(4),
                    Self::Rsasha1 => std::option::Option::Some(5),
                    Self::Dsansec3Sha1 => std::option::Option::Some(6),
                    Self::Rsasha1Nsec3Sha1 => std::option::Option::Some(7),
                    Self::Rsasha256 => std::option::Option::Some(8),
                    Self::Rsasha512 => std::option::Option::Some(10),
                    Self::Eccgost => std::option::Option::Some(12),
                    Self::Ecdsap256Sha256 => std::option::Option::Some(13),
                    Self::Ecdsap384Sha384 => std::option::Option::Some(14),
                    Self::Ed25519 => std::option::Option::Some(15),
                    Self::Ed448 => std::option::Option::Some(16),
                    Self::Indirect => std::option::Option::Some(252),
                    Self::Privatedns => std::option::Option::Some(253),
                    Self::Privateoid => std::option::Option::Some(254),
                    Self::UnknownValue(u) => u.0.value(),
                }
            }

            /// Gets the enum value as a string.
            ///
            /// Returns `None` if the enum contains an unknown value deserialized from
            /// the integer representation of enums.
            pub fn name(&self) -> std::option::Option<&str> {
                match self {
                    Self::Unspecified => std::option::Option::Some("ALGORITHM_UNSPECIFIED"),
                    Self::Rsamd5 => std::option::Option::Some("RSAMD5"),
                    Self::Dh => std::option::Option::Some("DH"),
                    Self::Dsa => std::option::Option::Some("DSA"),
                    Self::Ecc => std::option::Option::Some("ECC"),
                    Self::Rsasha1 => std::option::Option::Some("RSASHA1"),
                    Self::Dsansec3Sha1 => std::option::Option::Some("DSANSEC3SHA1"),
                    Self::Rsasha1Nsec3Sha1 => std::option::Option::Some("RSASHA1NSEC3SHA1"),
                    Self::Rsasha256 => std::option::Option::Some("RSASHA256"),
                    Self::Rsasha512 => std::option::Option::Some("RSASHA512"),
                    Self::Eccgost => std::option::Option::Some("ECCGOST"),
                    Self::Ecdsap256Sha256 => std::option::Option::Some("ECDSAP256SHA256"),
                    Self::Ecdsap384Sha384 => std::option::Option::Some("ECDSAP384SHA384"),
                    Self::Ed25519 => std::option::Option::Some("ED25519"),
                    Self::Ed448 => std::option::Option::Some("ED448"),
                    Self::Indirect => std::option::Option::Some("INDIRECT"),
                    Self::Privatedns => std::option::Option::Some("PRIVATEDNS"),
                    Self::Privateoid => std::option::Option::Some("PRIVATEOID"),
                    Self::UnknownValue(u) => u.0.name(),
                }
            }
        }

        impl std::default::Default for Algorithm {
            fn default() -> Self {
                use std::convert::From;
                Self::from(0)
            }
        }

        impl std::fmt::Display for Algorithm {
            fn fmt(
                &self,
                f: &mut std::fmt::Formatter<'_>,
            ) -> std::result::Result<(), std::fmt::Error> {
                wkt::internal::display_enum(f, self.name(), self.value())
            }
        }

        impl std::convert::From<i32> for Algorithm {
            fn from(value: i32) -> Self {
                match value {
                    0 => Self::Unspecified,
                    1 => Self::Rsamd5,
                    2 => Self::Dh,
                    3 => Self::Dsa,
                    4 => Self::Ecc,
                    5 => Self::Rsasha1,
                    6 => Self::Dsansec3Sha1,
                    7 => Self::Rsasha1Nsec3Sha1,
                    8 => Self::Rsasha256,
                    10 => Self::Rsasha512,
                    12 => Self::Eccgost,
                    13 => Self::Ecdsap256Sha256,
                    14 => Self::Ecdsap384Sha384,
                    15 => Self::Ed25519,
                    16 => Self::Ed448,
                    252 => Self::Indirect,
                    253 => Self::Privatedns,
                    254 => Self::Privateoid,
                    _ => Self::UnknownValue(algorithm::UnknownValue(
                        wkt::internal::UnknownEnumValue::Integer(value),
                    )),
                }
            }
        }

        impl std::convert::From<&str> for Algorithm {
            fn from(value: &str) -> Self {
                use std::string::ToString;
                match value {
                    "ALGORITHM_UNSPECIFIED" => Self::Unspecified,
                    "RSAMD5" => Self::Rsamd5,
                    "DH" => Self::Dh,
                    "DSA" => Self::Dsa,
                    "ECC" => Self::Ecc,
                    "RSASHA1" => Self::Rsasha1,
                    "DSANSEC3SHA1" => Self::Dsansec3Sha1,
                    "RSASHA1NSEC3SHA1" => Self::Rsasha1Nsec3Sha1,
                    "RSASHA256" => Self::Rsasha256,
                    "RSASHA512" => Self::Rsasha512,
                    "ECCGOST" => Self::Eccgost,
                    "ECDSAP256SHA256" => Self::Ecdsap256Sha256,
                    "ECDSAP384SHA384" => Self::Ecdsap384Sha384,
                    "ED25519" => Self::Ed25519,
                    "ED448" => Self::Ed448,
                    "INDIRECT" => Self::Indirect,
                    "PRIVATEDNS" => Self::Privatedns,
                    "PRIVATEOID" => Self::Privateoid,
                    _ => Self::UnknownValue(algorithm::UnknownValue(
                        wkt::internal::UnknownEnumValue::String(value.to_string()),
                    )),
                }
            }
        }

        impl serde::ser::Serialize for Algorithm {
            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
            where
                S: serde::Serializer,
            {
                match self {
                    Self::Unspecified => serializer.serialize_i32(0),
                    Self::Rsamd5 => serializer.serialize_i32(1),
                    Self::Dh => serializer.serialize_i32(2),
                    Self::Dsa => serializer.serialize_i32(3),
                    Self::Ecc => serializer.serialize_i32(4),
                    Self::Rsasha1 => serializer.serialize_i32(5),
                    Self::Dsansec3Sha1 => serializer.serialize_i32(6),
                    Self::Rsasha1Nsec3Sha1 => serializer.serialize_i32(7),
                    Self::Rsasha256 => serializer.serialize_i32(8),
                    Self::Rsasha512 => serializer.serialize_i32(10),
                    Self::Eccgost => serializer.serialize_i32(12),
                    Self::Ecdsap256Sha256 => serializer.serialize_i32(13),
                    Self::Ecdsap384Sha384 => serializer.serialize_i32(14),
                    Self::Ed25519 => serializer.serialize_i32(15),
                    Self::Ed448 => serializer.serialize_i32(16),
                    Self::Indirect => serializer.serialize_i32(252),
                    Self::Privatedns => serializer.serialize_i32(253),
                    Self::Privateoid => serializer.serialize_i32(254),
                    Self::UnknownValue(u) => u.0.serialize(serializer),
                }
            }
        }

        impl<'de> serde::de::Deserialize<'de> for Algorithm {
            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                deserializer.deserialize_any(wkt::internal::EnumVisitor::<Algorithm>::new(
                    ".google.cloud.domains.v1.DnsSettings.DsRecord.Algorithm",
                ))
            }
        }

        /// List of hash functions that may have been used to generate a digest of a
        /// DNSKEY.
        ///
        /// # Working with unknown values
        ///
        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
        /// additional enum variants at any time. Adding new variants is not considered
        /// a breaking change. Applications should write their code in anticipation of:
        ///
        /// - New values appearing in future releases of the client library, **and**
        /// - New values received dynamically, without application changes.
        ///
        /// Please consult the [Working with enums] section in the user guide for some
        /// guidelines.
        ///
        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
        #[derive(Clone, Debug, PartialEq)]
        #[non_exhaustive]
        pub enum DigestType {
            /// The DigestType is unspecified.
            Unspecified,
            /// SHA-1. Not recommended for new deployments.
            Sha1,
            /// SHA-256.
            Sha256,
            /// GOST R 34.11-94.
            Gost3411,
            /// SHA-384.
            Sha384,
            /// If set, the enum was initialized with an unknown value.
            ///
            /// Applications can examine the value using [DigestType::value] or
            /// [DigestType::name].
            UnknownValue(digest_type::UnknownValue),
        }

        #[doc(hidden)]
        pub mod digest_type {
            #[allow(unused_imports)]
            use super::*;
            #[derive(Clone, Debug, PartialEq)]
            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
        }

        impl DigestType {
            /// Gets the enum value.
            ///
            /// Returns `None` if the enum contains an unknown value deserialized from
            /// the string representation of enums.
            pub fn value(&self) -> std::option::Option<i32> {
                match self {
                    Self::Unspecified => std::option::Option::Some(0),
                    Self::Sha1 => std::option::Option::Some(1),
                    Self::Sha256 => std::option::Option::Some(2),
                    Self::Gost3411 => std::option::Option::Some(3),
                    Self::Sha384 => std::option::Option::Some(4),
                    Self::UnknownValue(u) => u.0.value(),
                }
            }

            /// Gets the enum value as a string.
            ///
            /// Returns `None` if the enum contains an unknown value deserialized from
            /// the integer representation of enums.
            pub fn name(&self) -> std::option::Option<&str> {
                match self {
                    Self::Unspecified => std::option::Option::Some("DIGEST_TYPE_UNSPECIFIED"),
                    Self::Sha1 => std::option::Option::Some("SHA1"),
                    Self::Sha256 => std::option::Option::Some("SHA256"),
                    Self::Gost3411 => std::option::Option::Some("GOST3411"),
                    Self::Sha384 => std::option::Option::Some("SHA384"),
                    Self::UnknownValue(u) => u.0.name(),
                }
            }
        }

        impl std::default::Default for DigestType {
            fn default() -> Self {
                use std::convert::From;
                Self::from(0)
            }
        }

        impl std::fmt::Display for DigestType {
            fn fmt(
                &self,
                f: &mut std::fmt::Formatter<'_>,
            ) -> std::result::Result<(), std::fmt::Error> {
                wkt::internal::display_enum(f, self.name(), self.value())
            }
        }

        impl std::convert::From<i32> for DigestType {
            fn from(value: i32) -> Self {
                match value {
                    0 => Self::Unspecified,
                    1 => Self::Sha1,
                    2 => Self::Sha256,
                    3 => Self::Gost3411,
                    4 => Self::Sha384,
                    _ => Self::UnknownValue(digest_type::UnknownValue(
                        wkt::internal::UnknownEnumValue::Integer(value),
                    )),
                }
            }
        }

        impl std::convert::From<&str> for DigestType {
            fn from(value: &str) -> Self {
                use std::string::ToString;
                match value {
                    "DIGEST_TYPE_UNSPECIFIED" => Self::Unspecified,
                    "SHA1" => Self::Sha1,
                    "SHA256" => Self::Sha256,
                    "GOST3411" => Self::Gost3411,
                    "SHA384" => Self::Sha384,
                    _ => Self::UnknownValue(digest_type::UnknownValue(
                        wkt::internal::UnknownEnumValue::String(value.to_string()),
                    )),
                }
            }
        }

        impl serde::ser::Serialize for DigestType {
            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
            where
                S: serde::Serializer,
            {
                match self {
                    Self::Unspecified => serializer.serialize_i32(0),
                    Self::Sha1 => serializer.serialize_i32(1),
                    Self::Sha256 => serializer.serialize_i32(2),
                    Self::Gost3411 => serializer.serialize_i32(3),
                    Self::Sha384 => serializer.serialize_i32(4),
                    Self::UnknownValue(u) => u.0.serialize(serializer),
                }
            }
        }

        impl<'de> serde::de::Deserialize<'de> for DigestType {
            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                deserializer.deserialize_any(wkt::internal::EnumVisitor::<DigestType>::new(
                    ".google.cloud.domains.v1.DnsSettings.DsRecord.DigestType",
                ))
            }
        }
    }

    /// Defines a host on your domain that is a DNS name server for your domain
    /// and/or other domains. Glue records are a way of making the IP address of a
    /// name server known, even when it serves DNS queries for its parent domain.
    /// For example, when `ns.example.com` is a name server for `example.com`, the
    /// host `ns.example.com` must have a glue record to break the circular DNS
    /// reference.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct GlueRecord {
        /// Required. Domain name of the host in Punycode format.
        pub host_name: std::string::String,

        /// List of IPv4 addresses corresponding to this host in the standard decimal
        /// format (e.g. `198.51.100.1`). At least one of `ipv4_address` and
        /// `ipv6_address` must be set.
        pub ipv4_addresses: std::vec::Vec<std::string::String>,

        /// List of IPv6 addresses corresponding to this host in the standard
        /// hexadecimal format (e.g. `2001:db8::`). At least one of
        /// `ipv4_address` and `ipv6_address` must be set.
        pub ipv6_addresses: std::vec::Vec<std::string::String>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl GlueRecord {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [host_name][crate::model::dns_settings::GlueRecord::host_name].
        pub fn set_host_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.host_name = v.into();
            self
        }

        /// Sets the value of [ipv4_addresses][crate::model::dns_settings::GlueRecord::ipv4_addresses].
        pub fn set_ipv4_addresses<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<std::string::String>,
        {
            use std::iter::Iterator;
            self.ipv4_addresses = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [ipv6_addresses][crate::model::dns_settings::GlueRecord::ipv6_addresses].
        pub fn set_ipv6_addresses<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<std::string::String>,
        {
            use std::iter::Iterator;
            self.ipv6_addresses = v.into_iter().map(|i| i.into()).collect();
            self
        }
    }

    impl wkt::message::Message for GlueRecord {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.domains.v1.DnsSettings.GlueRecord"
        }
    }

    /// The publication state of DS records for a `Registration`.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum DsState {
        /// DS state is unspecified.
        Unspecified,
        /// DNSSEC is disabled for this domain. No DS records for this domain are
        /// published in the parent DNS zone.
        DsRecordsUnpublished,
        /// DNSSEC is enabled for this domain. Appropriate DS records for this domain
        /// are published in the parent DNS zone. This option is valid only if the
        /// DNS zone referenced in the `Registration`'s `dns_provider` field is
        /// already DNSSEC-signed.
        DsRecordsPublished,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [DsState::value] or
        /// [DsState::name].
        UnknownValue(ds_state::UnknownValue),
    }

    #[doc(hidden)]
    pub mod ds_state {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl DsState {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::DsRecordsUnpublished => std::option::Option::Some(1),
                Self::DsRecordsPublished => std::option::Option::Some(2),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("DS_STATE_UNSPECIFIED"),
                Self::DsRecordsUnpublished => std::option::Option::Some("DS_RECORDS_UNPUBLISHED"),
                Self::DsRecordsPublished => std::option::Option::Some("DS_RECORDS_PUBLISHED"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for DsState {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for DsState {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for DsState {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::DsRecordsUnpublished,
                2 => Self::DsRecordsPublished,
                _ => Self::UnknownValue(ds_state::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for DsState {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "DS_STATE_UNSPECIFIED" => Self::Unspecified,
                "DS_RECORDS_UNPUBLISHED" => Self::DsRecordsUnpublished,
                "DS_RECORDS_PUBLISHED" => Self::DsRecordsPublished,
                _ => Self::UnknownValue(ds_state::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for DsState {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::DsRecordsUnpublished => serializer.serialize_i32(1),
                Self::DsRecordsPublished => serializer.serialize_i32(2),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for DsState {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<DsState>::new(
                ".google.cloud.domains.v1.DnsSettings.DsState",
            ))
        }
    }

    /// The DNS provider of the registration.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum DnsProvider {
        /// An arbitrary DNS provider identified by its name servers.
        CustomDns(std::boxed::Box<crate::model::dns_settings::CustomDns>),
        /// The free DNS zone provided by
        /// [Google Domains](https://domains.google/).
        GoogleDomainsDns(std::boxed::Box<crate::model::dns_settings::GoogleDomainsDns>),
    }
}

/// Defines the contact information associated with a `Registration`.
///
/// [ICANN](https://icann.org/) requires all domain names to have associated
/// contact information. The `registrant_contact` is considered the
/// domain's legal owner, and often the other contacts are identical.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ContactSettings {
    /// Required. Privacy setting for the contacts associated with the `Registration`.
    pub privacy: crate::model::ContactPrivacy,

    /// Required. The registrant contact for the `Registration`.
    ///
    /// *Caution: Anyone with access to this email address, phone number,
    /// and/or postal address can take control of the domain.*
    ///
    /// *Warning: For new `Registration`s, the registrant receives an email
    /// confirmation that they must complete within 15 days to avoid domain
    /// suspension.*
    pub registrant_contact: std::option::Option<crate::model::contact_settings::Contact>,

    /// Required. The administrative contact for the `Registration`.
    pub admin_contact: std::option::Option<crate::model::contact_settings::Contact>,

    /// Required. The technical contact for the `Registration`.
    pub technical_contact: std::option::Option<crate::model::contact_settings::Contact>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ContactSettings {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [privacy][crate::model::ContactSettings::privacy].
    pub fn set_privacy<T: std::convert::Into<crate::model::ContactPrivacy>>(
        mut self,
        v: T,
    ) -> Self {
        self.privacy = v.into();
        self
    }

    /// Sets the value of [registrant_contact][crate::model::ContactSettings::registrant_contact].
    pub fn set_registrant_contact<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::contact_settings::Contact>,
    {
        self.registrant_contact = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [registrant_contact][crate::model::ContactSettings::registrant_contact].
    pub fn set_or_clear_registrant_contact<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::contact_settings::Contact>,
    {
        self.registrant_contact = v.map(|x| x.into());
        self
    }

    /// Sets the value of [admin_contact][crate::model::ContactSettings::admin_contact].
    pub fn set_admin_contact<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::contact_settings::Contact>,
    {
        self.admin_contact = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [admin_contact][crate::model::ContactSettings::admin_contact].
    pub fn set_or_clear_admin_contact<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::contact_settings::Contact>,
    {
        self.admin_contact = v.map(|x| x.into());
        self
    }

    /// Sets the value of [technical_contact][crate::model::ContactSettings::technical_contact].
    pub fn set_technical_contact<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::contact_settings::Contact>,
    {
        self.technical_contact = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [technical_contact][crate::model::ContactSettings::technical_contact].
    pub fn set_or_clear_technical_contact<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::contact_settings::Contact>,
    {
        self.technical_contact = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for ContactSettings {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.domains.v1.ContactSettings"
    }
}

/// Defines additional types related to [ContactSettings].
pub mod contact_settings {
    #[allow(unused_imports)]
    use super::*;

    /// Details required for a contact associated with a `Registration`.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct Contact {
        /// Required. Postal address of the contact.
        pub postal_address: std::option::Option<gtype::model::PostalAddress>,

        /// Required. Email address of the contact.
        pub email: std::string::String,

        /// Required. Phone number of the contact in international format. For example,
        /// `"+1-800-555-0123"`.
        pub phone_number: std::string::String,

        /// Fax number of the contact in international format. For example,
        /// `"+1-800-555-0123"`.
        pub fax_number: std::string::String,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl Contact {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [postal_address][crate::model::contact_settings::Contact::postal_address].
        pub fn set_postal_address<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<gtype::model::PostalAddress>,
        {
            self.postal_address = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [postal_address][crate::model::contact_settings::Contact::postal_address].
        pub fn set_or_clear_postal_address<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<gtype::model::PostalAddress>,
        {
            self.postal_address = v.map(|x| x.into());
            self
        }

        /// Sets the value of [email][crate::model::contact_settings::Contact::email].
        pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.email = v.into();
            self
        }

        /// Sets the value of [phone_number][crate::model::contact_settings::Contact::phone_number].
        pub fn set_phone_number<T: std::convert::Into<std::string::String>>(
            mut self,
            v: T,
        ) -> Self {
            self.phone_number = v.into();
            self
        }

        /// Sets the value of [fax_number][crate::model::contact_settings::Contact::fax_number].
        pub fn set_fax_number<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.fax_number = v.into();
            self
        }
    }

    impl wkt::message::Message for Contact {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.domains.v1.ContactSettings.Contact"
        }
    }
}

/// Request for the `SearchDomains` method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SearchDomainsRequest {
    /// Required. String used to search for available domain names.
    pub query: std::string::String,

    /// Required. The location. Must be in the format `projects/*/locations/*`.
    pub location: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl SearchDomainsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [query][crate::model::SearchDomainsRequest::query].
    pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.query = v.into();
        self
    }

    /// Sets the value of [location][crate::model::SearchDomainsRequest::location].
    pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.location = v.into();
        self
    }
}

impl wkt::message::Message for SearchDomainsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.domains.v1.SearchDomainsRequest"
    }
}

/// Response for the `SearchDomains` method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SearchDomainsResponse {
    /// Results of the domain name search.
    pub register_parameters: std::vec::Vec<crate::model::RegisterParameters>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl SearchDomainsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [register_parameters][crate::model::SearchDomainsResponse::register_parameters].
    pub fn set_register_parameters<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::RegisterParameters>,
    {
        use std::iter::Iterator;
        self.register_parameters = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for SearchDomainsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.domains.v1.SearchDomainsResponse"
    }
}

/// Request for the `RetrieveRegisterParameters` method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RetrieveRegisterParametersRequest {
    /// Required. The domain name. Unicode domain names must be expressed in Punycode format.
    pub domain_name: std::string::String,

    /// Required. The location. Must be in the format `projects/*/locations/*`.
    pub location: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl RetrieveRegisterParametersRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [domain_name][crate::model::RetrieveRegisterParametersRequest::domain_name].
    pub fn set_domain_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.domain_name = v.into();
        self
    }

    /// Sets the value of [location][crate::model::RetrieveRegisterParametersRequest::location].
    pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.location = v.into();
        self
    }
}

impl wkt::message::Message for RetrieveRegisterParametersRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.domains.v1.RetrieveRegisterParametersRequest"
    }
}

/// Response for the `RetrieveRegisterParameters` method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RetrieveRegisterParametersResponse {
    /// Parameters to use when calling the `RegisterDomain` method.
    pub register_parameters: std::option::Option<crate::model::RegisterParameters>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl RetrieveRegisterParametersResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [register_parameters][crate::model::RetrieveRegisterParametersResponse::register_parameters].
    pub fn set_register_parameters<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::RegisterParameters>,
    {
        self.register_parameters = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [register_parameters][crate::model::RetrieveRegisterParametersResponse::register_parameters].
    pub fn set_or_clear_register_parameters<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::RegisterParameters>,
    {
        self.register_parameters = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for RetrieveRegisterParametersResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.domains.v1.RetrieveRegisterParametersResponse"
    }
}

/// Request for the `RegisterDomain` method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RegisterDomainRequest {
    /// Required. The parent resource of the `Registration`. Must be in the
    /// format `projects/*/locations/*`.
    pub parent: std::string::String,

    /// Required. The complete `Registration` resource to be created.
    pub registration: std::option::Option<crate::model::Registration>,

    /// The list of domain notices that you acknowledge. Call
    /// `RetrieveRegisterParameters` to see the notices that need acknowledgement.
    pub domain_notices: std::vec::Vec<crate::model::DomainNotice>,

    /// The list of contact notices that the caller acknowledges. The notices
    /// needed here depend on the values specified in
    /// `registration.contact_settings`.
    pub contact_notices: std::vec::Vec<crate::model::ContactNotice>,

    /// Required. Yearly price to register or renew the domain.
    /// The value that should be put here can be obtained from
    /// RetrieveRegisterParameters or SearchDomains calls.
    pub yearly_price: std::option::Option<gtype::model::Money>,

    /// When true, only validation is performed, without actually registering
    /// the domain. Follows:
    /// <https://cloud.google.com/apis/design/design_patterns#request_validation>
    pub validate_only: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl RegisterDomainRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::RegisterDomainRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [registration][crate::model::RegisterDomainRequest::registration].
    pub fn set_registration<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Registration>,
    {
        self.registration = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [registration][crate::model::RegisterDomainRequest::registration].
    pub fn set_or_clear_registration<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Registration>,
    {
        self.registration = v.map(|x| x.into());
        self
    }

    /// Sets the value of [domain_notices][crate::model::RegisterDomainRequest::domain_notices].
    pub fn set_domain_notices<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::DomainNotice>,
    {
        use std::iter::Iterator;
        self.domain_notices = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [contact_notices][crate::model::RegisterDomainRequest::contact_notices].
    pub fn set_contact_notices<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::ContactNotice>,
    {
        use std::iter::Iterator;
        self.contact_notices = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [yearly_price][crate::model::RegisterDomainRequest::yearly_price].
    pub fn set_yearly_price<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<gtype::model::Money>,
    {
        self.yearly_price = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [yearly_price][crate::model::RegisterDomainRequest::yearly_price].
    pub fn set_or_clear_yearly_price<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<gtype::model::Money>,
    {
        self.yearly_price = v.map(|x| x.into());
        self
    }

    /// Sets the value of [validate_only][crate::model::RegisterDomainRequest::validate_only].
    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.validate_only = v.into();
        self
    }
}

impl wkt::message::Message for RegisterDomainRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.domains.v1.RegisterDomainRequest"
    }
}

/// Request for the `RetrieveTransferParameters` method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RetrieveTransferParametersRequest {
    /// Required. The domain name. Unicode domain names must be expressed in Punycode format.
    pub domain_name: std::string::String,

    /// Required. The location. Must be in the format `projects/*/locations/*`.
    pub location: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl RetrieveTransferParametersRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [domain_name][crate::model::RetrieveTransferParametersRequest::domain_name].
    pub fn set_domain_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.domain_name = v.into();
        self
    }

    /// Sets the value of [location][crate::model::RetrieveTransferParametersRequest::location].
    pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.location = v.into();
        self
    }
}

impl wkt::message::Message for RetrieveTransferParametersRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.domains.v1.RetrieveTransferParametersRequest"
    }
}

/// Response for the `RetrieveTransferParameters` method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RetrieveTransferParametersResponse {
    /// Parameters to use when calling the `TransferDomain` method.
    pub transfer_parameters: std::option::Option<crate::model::TransferParameters>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl RetrieveTransferParametersResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [transfer_parameters][crate::model::RetrieveTransferParametersResponse::transfer_parameters].
    pub fn set_transfer_parameters<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::TransferParameters>,
    {
        self.transfer_parameters = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [transfer_parameters][crate::model::RetrieveTransferParametersResponse::transfer_parameters].
    pub fn set_or_clear_transfer_parameters<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::TransferParameters>,
    {
        self.transfer_parameters = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for RetrieveTransferParametersResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.domains.v1.RetrieveTransferParametersResponse"
    }
}

/// Request for the `TransferDomain` method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TransferDomainRequest {
    /// Required. The parent resource of the `Registration`. Must be in the
    /// format `projects/*/locations/*`.
    pub parent: std::string::String,

    /// Required. The complete `Registration` resource to be created.
    ///
    /// You can leave `registration.dns_settings` unset to import the
    /// domain's current DNS configuration from its current registrar. Use this
    /// option only if you are sure that the domain's current DNS service
    /// does not cease upon transfer, as is often the case for DNS services
    /// provided for free by the registrar.
    pub registration: std::option::Option<crate::model::Registration>,

    /// The list of contact notices that you acknowledge. The notices
    /// needed here depend on the values specified in
    /// `registration.contact_settings`.
    pub contact_notices: std::vec::Vec<crate::model::ContactNotice>,

    /// Required. Acknowledgement of the price to transfer or renew the domain for one year.
    /// Call `RetrieveTransferParameters` to obtain the price, which you must
    /// acknowledge.
    pub yearly_price: std::option::Option<gtype::model::Money>,

    /// The domain's transfer authorization code. You can obtain this from the
    /// domain's current registrar.
    pub authorization_code: std::option::Option<crate::model::AuthorizationCode>,

    /// Validate the request without actually transferring the domain.
    pub validate_only: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl TransferDomainRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::TransferDomainRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [registration][crate::model::TransferDomainRequest::registration].
    pub fn set_registration<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Registration>,
    {
        self.registration = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [registration][crate::model::TransferDomainRequest::registration].
    pub fn set_or_clear_registration<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Registration>,
    {
        self.registration = v.map(|x| x.into());
        self
    }

    /// Sets the value of [contact_notices][crate::model::TransferDomainRequest::contact_notices].
    pub fn set_contact_notices<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::ContactNotice>,
    {
        use std::iter::Iterator;
        self.contact_notices = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [yearly_price][crate::model::TransferDomainRequest::yearly_price].
    pub fn set_yearly_price<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<gtype::model::Money>,
    {
        self.yearly_price = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [yearly_price][crate::model::TransferDomainRequest::yearly_price].
    pub fn set_or_clear_yearly_price<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<gtype::model::Money>,
    {
        self.yearly_price = v.map(|x| x.into());
        self
    }

    /// Sets the value of [authorization_code][crate::model::TransferDomainRequest::authorization_code].
    pub fn set_authorization_code<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::AuthorizationCode>,
    {
        self.authorization_code = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [authorization_code][crate::model::TransferDomainRequest::authorization_code].
    pub fn set_or_clear_authorization_code<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::AuthorizationCode>,
    {
        self.authorization_code = v.map(|x| x.into());
        self
    }

    /// Sets the value of [validate_only][crate::model::TransferDomainRequest::validate_only].
    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.validate_only = v.into();
        self
    }
}

impl wkt::message::Message for TransferDomainRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.domains.v1.TransferDomainRequest"
    }
}

/// Request for the `ListRegistrations` method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListRegistrationsRequest {
    /// Required. The project and location from which to list `Registration`s, specified in
    /// the format `projects/*/locations/*`.
    pub parent: std::string::String,

    /// Maximum number of results to return.
    pub page_size: i32,

    /// When set to the `next_page_token` from a prior response, provides the next
    /// page of results.
    pub page_token: std::string::String,

    /// Filter expression to restrict the `Registration`s returned.
    ///
    /// The expression must specify the field name, a comparison operator, and the
    /// value that you want to use for filtering. The value must be a string, a
    /// number, a boolean, or an enum value. The comparison operator should be one
    /// of =, !=, >, <, >=, <=, or : for prefix or wildcard matches.
    ///
    /// For example, to filter to a specific domain name, use an expression like
    /// `domainName="example.com"`. You can also check for the existence of a
    /// field; for example, to find domains using custom DNS settings, use an
    /// expression like `dnsSettings.customDns:*`.
    ///
    /// You can also create compound filters by combining expressions with the
    /// `AND` and `OR` operators. For example, to find domains that are suspended
    /// or have specific issues flagged, use an expression like
    /// `(state=SUSPENDED) OR (issue:*)`.
    pub filter: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListRegistrationsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListRegistrationsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListRegistrationsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListRegistrationsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListRegistrationsRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }
}

impl wkt::message::Message for ListRegistrationsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.domains.v1.ListRegistrationsRequest"
    }
}

/// Response for the `ListRegistrations` method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListRegistrationsResponse {
    /// A list of `Registration`s.
    pub registrations: std::vec::Vec<crate::model::Registration>,

    /// When present, there are more results to retrieve. Set `page_token` to this
    /// value on a subsequent call to get the next page of results.
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListRegistrationsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [registrations][crate::model::ListRegistrationsResponse::registrations].
    pub fn set_registrations<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Registration>,
    {
        use std::iter::Iterator;
        self.registrations = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListRegistrationsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListRegistrationsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.domains.v1.ListRegistrationsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListRegistrationsResponse {
    type PageItem = crate::model::Registration;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.registrations
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request for the `GetRegistration` method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetRegistrationRequest {
    /// Required. The name of the `Registration` to get, in the format
    /// `projects/*/locations/*/registrations/*`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetRegistrationRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetRegistrationRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetRegistrationRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.domains.v1.GetRegistrationRequest"
    }
}

/// Request for the `UpdateRegistration` method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateRegistrationRequest {
    /// Fields of the `Registration` to update.
    pub registration: std::option::Option<crate::model::Registration>,

    /// Required. The field mask describing which fields to update as a comma-separated list.
    /// For example, if only the labels are being updated, the `update_mask` is
    /// `"labels"`.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateRegistrationRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [registration][crate::model::UpdateRegistrationRequest::registration].
    pub fn set_registration<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Registration>,
    {
        self.registration = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [registration][crate::model::UpdateRegistrationRequest::registration].
    pub fn set_or_clear_registration<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Registration>,
    {
        self.registration = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_mask][crate::model::UpdateRegistrationRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateRegistrationRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for UpdateRegistrationRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.domains.v1.UpdateRegistrationRequest"
    }
}

/// Request for the `ConfigureManagementSettings` method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ConfigureManagementSettingsRequest {
    /// Required. The name of the `Registration` whose management settings are being updated,
    /// in the format `projects/*/locations/*/registrations/*`.
    pub registration: std::string::String,

    /// Fields of the `ManagementSettings` to update.
    pub management_settings: std::option::Option<crate::model::ManagementSettings>,

    /// Required. The field mask describing which fields to update as a comma-separated list.
    /// For example, if only the transfer lock is being updated, the `update_mask`
    /// is `"transfer_lock_state"`.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ConfigureManagementSettingsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [registration][crate::model::ConfigureManagementSettingsRequest::registration].
    pub fn set_registration<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.registration = v.into();
        self
    }

    /// Sets the value of [management_settings][crate::model::ConfigureManagementSettingsRequest::management_settings].
    pub fn set_management_settings<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ManagementSettings>,
    {
        self.management_settings = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [management_settings][crate::model::ConfigureManagementSettingsRequest::management_settings].
    pub fn set_or_clear_management_settings<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ManagementSettings>,
    {
        self.management_settings = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_mask][crate::model::ConfigureManagementSettingsRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::ConfigureManagementSettingsRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for ConfigureManagementSettingsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.domains.v1.ConfigureManagementSettingsRequest"
    }
}

/// Request for the `ConfigureDnsSettings` method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ConfigureDnsSettingsRequest {
    /// Required. The name of the `Registration` whose DNS settings are being updated,
    /// in the format `projects/*/locations/*/registrations/*`.
    pub registration: std::string::String,

    /// Fields of the `DnsSettings` to update.
    pub dns_settings: std::option::Option<crate::model::DnsSettings>,

    /// Required. The field mask describing which fields to update as a comma-separated list.
    /// For example, if only the name servers are being updated for an existing
    /// Custom DNS configuration, the `update_mask` is
    /// `"custom_dns.name_servers"`.
    ///
    /// When changing the DNS provider from one type to another, pass the new
    /// provider's field name as part of the field mask. For example, when changing
    /// from a Google Domains DNS configuration to a Custom DNS configuration, the
    /// `update_mask` is `"custom_dns"`. //
    pub update_mask: std::option::Option<wkt::FieldMask>,

    /// Validate the request without actually updating the DNS settings.
    pub validate_only: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ConfigureDnsSettingsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [registration][crate::model::ConfigureDnsSettingsRequest::registration].
    pub fn set_registration<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.registration = v.into();
        self
    }

    /// Sets the value of [dns_settings][crate::model::ConfigureDnsSettingsRequest::dns_settings].
    pub fn set_dns_settings<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::DnsSettings>,
    {
        self.dns_settings = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [dns_settings][crate::model::ConfigureDnsSettingsRequest::dns_settings].
    pub fn set_or_clear_dns_settings<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::DnsSettings>,
    {
        self.dns_settings = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_mask][crate::model::ConfigureDnsSettingsRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::ConfigureDnsSettingsRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }

    /// Sets the value of [validate_only][crate::model::ConfigureDnsSettingsRequest::validate_only].
    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.validate_only = v.into();
        self
    }
}

impl wkt::message::Message for ConfigureDnsSettingsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.domains.v1.ConfigureDnsSettingsRequest"
    }
}

/// Request for the `ConfigureContactSettings` method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ConfigureContactSettingsRequest {
    /// Required. The name of the `Registration` whose contact settings are being updated,
    /// in the format `projects/*/locations/*/registrations/*`.
    pub registration: std::string::String,

    /// Fields of the `ContactSettings` to update.
    pub contact_settings: std::option::Option<crate::model::ContactSettings>,

    /// Required. The field mask describing which fields to update as a comma-separated list.
    /// For example, if only the registrant contact is being updated, the
    /// `update_mask` is `"registrant_contact"`.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    /// The list of contact notices that the caller acknowledges. The notices
    /// needed here depend on the values specified in `contact_settings`.
    pub contact_notices: std::vec::Vec<crate::model::ContactNotice>,

    /// Validate the request without actually updating the contact settings.
    pub validate_only: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ConfigureContactSettingsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [registration][crate::model::ConfigureContactSettingsRequest::registration].
    pub fn set_registration<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.registration = v.into();
        self
    }

    /// Sets the value of [contact_settings][crate::model::ConfigureContactSettingsRequest::contact_settings].
    pub fn set_contact_settings<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ContactSettings>,
    {
        self.contact_settings = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [contact_settings][crate::model::ConfigureContactSettingsRequest::contact_settings].
    pub fn set_or_clear_contact_settings<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ContactSettings>,
    {
        self.contact_settings = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_mask][crate::model::ConfigureContactSettingsRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::ConfigureContactSettingsRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }

    /// Sets the value of [contact_notices][crate::model::ConfigureContactSettingsRequest::contact_notices].
    pub fn set_contact_notices<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::ContactNotice>,
    {
        use std::iter::Iterator;
        self.contact_notices = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [validate_only][crate::model::ConfigureContactSettingsRequest::validate_only].
    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.validate_only = v.into();
        self
    }
}

impl wkt::message::Message for ConfigureContactSettingsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.domains.v1.ConfigureContactSettingsRequest"
    }
}

/// Request for the `ExportRegistration` method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExportRegistrationRequest {
    /// Required. The name of the `Registration` to export,
    /// in the format `projects/*/locations/*/registrations/*`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ExportRegistrationRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::ExportRegistrationRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for ExportRegistrationRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.domains.v1.ExportRegistrationRequest"
    }
}

/// Request for the `DeleteRegistration` method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteRegistrationRequest {
    /// Required. The name of the `Registration` to delete,
    /// in the format `projects/*/locations/*/registrations/*`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteRegistrationRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteRegistrationRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for DeleteRegistrationRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.domains.v1.DeleteRegistrationRequest"
    }
}

/// Request for the `RetrieveAuthorizationCode` method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RetrieveAuthorizationCodeRequest {
    /// Required. The name of the `Registration` whose authorization code is being retrieved,
    /// in the format `projects/*/locations/*/registrations/*`.
    pub registration: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl RetrieveAuthorizationCodeRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [registration][crate::model::RetrieveAuthorizationCodeRequest::registration].
    pub fn set_registration<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.registration = v.into();
        self
    }
}

impl wkt::message::Message for RetrieveAuthorizationCodeRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.domains.v1.RetrieveAuthorizationCodeRequest"
    }
}

/// Request for the `ResetAuthorizationCode` method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ResetAuthorizationCodeRequest {
    /// Required. The name of the `Registration` whose authorization code is being reset,
    /// in the format `projects/*/locations/*/registrations/*`.
    pub registration: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ResetAuthorizationCodeRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [registration][crate::model::ResetAuthorizationCodeRequest::registration].
    pub fn set_registration<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.registration = v.into();
        self
    }
}

impl wkt::message::Message for ResetAuthorizationCodeRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.domains.v1.ResetAuthorizationCodeRequest"
    }
}

/// Parameters required to register a new domain.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RegisterParameters {
    /// The domain name. Unicode domain names are expressed in Punycode format.
    pub domain_name: std::string::String,

    /// Indicates whether the domain is available for registration. This value is
    /// accurate when obtained by calling `RetrieveRegisterParameters`, but is
    /// approximate when obtained by calling `SearchDomains`.
    pub availability: crate::model::register_parameters::Availability,

    /// Contact privacy options that the domain supports.
    pub supported_privacy: std::vec::Vec<crate::model::ContactPrivacy>,

    /// Notices about special properties of the domain.
    pub domain_notices: std::vec::Vec<crate::model::DomainNotice>,

    /// Price to register or renew the domain for one year.
    pub yearly_price: std::option::Option<gtype::model::Money>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl RegisterParameters {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [domain_name][crate::model::RegisterParameters::domain_name].
    pub fn set_domain_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.domain_name = v.into();
        self
    }

    /// Sets the value of [availability][crate::model::RegisterParameters::availability].
    pub fn set_availability<
        T: std::convert::Into<crate::model::register_parameters::Availability>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.availability = v.into();
        self
    }

    /// Sets the value of [supported_privacy][crate::model::RegisterParameters::supported_privacy].
    pub fn set_supported_privacy<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::ContactPrivacy>,
    {
        use std::iter::Iterator;
        self.supported_privacy = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [domain_notices][crate::model::RegisterParameters::domain_notices].
    pub fn set_domain_notices<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::DomainNotice>,
    {
        use std::iter::Iterator;
        self.domain_notices = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [yearly_price][crate::model::RegisterParameters::yearly_price].
    pub fn set_yearly_price<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<gtype::model::Money>,
    {
        self.yearly_price = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [yearly_price][crate::model::RegisterParameters::yearly_price].
    pub fn set_or_clear_yearly_price<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<gtype::model::Money>,
    {
        self.yearly_price = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for RegisterParameters {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.domains.v1.RegisterParameters"
    }
}

/// Defines additional types related to [RegisterParameters].
pub mod register_parameters {
    #[allow(unused_imports)]
    use super::*;

    /// Possible availability states of a domain name.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Availability {
        /// The availability is unspecified.
        Unspecified,
        /// The domain is available for registration.
        Available,
        /// The domain is not available for registration. Generally this means it is
        /// already registered to another party.
        Unavailable,
        /// The domain is not currently supported by Cloud Domains, but may
        /// be available elsewhere.
        Unsupported,
        /// Cloud Domains is unable to determine domain availability, generally
        /// due to system maintenance at the domain name registry.
        Unknown,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [Availability::value] or
        /// [Availability::name].
        UnknownValue(availability::UnknownValue),
    }

    #[doc(hidden)]
    pub mod availability {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl Availability {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Available => std::option::Option::Some(1),
                Self::Unavailable => std::option::Option::Some(2),
                Self::Unsupported => std::option::Option::Some(3),
                Self::Unknown => std::option::Option::Some(4),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("AVAILABILITY_UNSPECIFIED"),
                Self::Available => std::option::Option::Some("AVAILABLE"),
                Self::Unavailable => std::option::Option::Some("UNAVAILABLE"),
                Self::Unsupported => std::option::Option::Some("UNSUPPORTED"),
                Self::Unknown => std::option::Option::Some("UNKNOWN"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for Availability {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for Availability {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for Availability {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Available,
                2 => Self::Unavailable,
                3 => Self::Unsupported,
                4 => Self::Unknown,
                _ => Self::UnknownValue(availability::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for Availability {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "AVAILABILITY_UNSPECIFIED" => Self::Unspecified,
                "AVAILABLE" => Self::Available,
                "UNAVAILABLE" => Self::Unavailable,
                "UNSUPPORTED" => Self::Unsupported,
                "UNKNOWN" => Self::Unknown,
                _ => Self::UnknownValue(availability::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for Availability {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Available => serializer.serialize_i32(1),
                Self::Unavailable => serializer.serialize_i32(2),
                Self::Unsupported => serializer.serialize_i32(3),
                Self::Unknown => serializer.serialize_i32(4),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for Availability {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Availability>::new(
                ".google.cloud.domains.v1.RegisterParameters.Availability",
            ))
        }
    }
}

/// Parameters required to transfer a domain from another registrar.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TransferParameters {
    /// The domain name. Unicode domain names are expressed in Punycode format.
    pub domain_name: std::string::String,

    /// The registrar that currently manages the domain.
    pub current_registrar: std::string::String,

    /// The name servers that currently store the configuration of the domain.
    pub name_servers: std::vec::Vec<std::string::String>,

    /// Indicates whether the domain is protected by a transfer lock. For a
    /// transfer to succeed, this must show `UNLOCKED`. To unlock a domain,
    /// go to its current registrar.
    pub transfer_lock_state: crate::model::TransferLockState,

    /// Contact privacy options that the domain supports.
    pub supported_privacy: std::vec::Vec<crate::model::ContactPrivacy>,

    /// Price to transfer or renew the domain for one year.
    pub yearly_price: std::option::Option<gtype::model::Money>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl TransferParameters {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [domain_name][crate::model::TransferParameters::domain_name].
    pub fn set_domain_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.domain_name = v.into();
        self
    }

    /// Sets the value of [current_registrar][crate::model::TransferParameters::current_registrar].
    pub fn set_current_registrar<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.current_registrar = v.into();
        self
    }

    /// Sets the value of [name_servers][crate::model::TransferParameters::name_servers].
    pub fn set_name_servers<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.name_servers = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [transfer_lock_state][crate::model::TransferParameters::transfer_lock_state].
    pub fn set_transfer_lock_state<T: std::convert::Into<crate::model::TransferLockState>>(
        mut self,
        v: T,
    ) -> Self {
        self.transfer_lock_state = v.into();
        self
    }

    /// Sets the value of [supported_privacy][crate::model::TransferParameters::supported_privacy].
    pub fn set_supported_privacy<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::ContactPrivacy>,
    {
        use std::iter::Iterator;
        self.supported_privacy = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [yearly_price][crate::model::TransferParameters::yearly_price].
    pub fn set_yearly_price<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<gtype::model::Money>,
    {
        self.yearly_price = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [yearly_price][crate::model::TransferParameters::yearly_price].
    pub fn set_or_clear_yearly_price<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<gtype::model::Money>,
    {
        self.yearly_price = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for TransferParameters {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.domains.v1.TransferParameters"
    }
}

/// Defines an authorization code.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AuthorizationCode {
    /// The Authorization Code in ASCII. It can be used to transfer the domain
    /// to or from another registrar.
    pub code: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl AuthorizationCode {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [code][crate::model::AuthorizationCode::code].
    pub fn set_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.code = v.into();
        self
    }
}

impl wkt::message::Message for AuthorizationCode {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.domains.v1.AuthorizationCode"
    }
}

/// Represents the metadata of the long-running operation. Output only.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct OperationMetadata {
    /// The time the operation was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// The time the operation finished running.
    pub end_time: std::option::Option<wkt::Timestamp>,

    /// Server-defined resource path for the target of the operation.
    pub target: std::string::String,

    /// Name of the verb executed by the operation.
    pub verb: std::string::String,

    /// Human-readable status of the operation, if any.
    pub status_detail: std::string::String,

    /// API version used to start the operation.
    pub api_version: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl OperationMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
    pub fn set_end_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [target][crate::model::OperationMetadata::target].
    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.target = v.into();
        self
    }

    /// Sets the value of [verb][crate::model::OperationMetadata::verb].
    pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.verb = v.into();
        self
    }

    /// Sets the value of [status_detail][crate::model::OperationMetadata::status_detail].
    pub fn set_status_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.status_detail = v.into();
        self
    }

    /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
    pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.api_version = v.into();
        self
    }
}

impl wkt::message::Message for OperationMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.domains.v1.OperationMetadata"
    }
}

/// Defines a set of possible contact privacy settings for a `Registration`.
///
/// [ICANN](https://icann.org/) maintains the WHOIS database, a publicly
/// accessible mapping from domain name to contact information, and requires that
/// each domain name have an entry. Choose from these options to control how much
/// information in your `ContactSettings` is published.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ContactPrivacy {
    /// The contact privacy settings are undefined.
    Unspecified,
    /// All the data from `ContactSettings` is publicly available. When setting
    /// this option, you must also provide a
    /// `PUBLIC_CONTACT_DATA_ACKNOWLEDGEMENT` in the `contact_notices` field of the
    /// request.
    PublicContactData,
    /// None of the data from `ContactSettings` is publicly available. Instead,
    /// proxy contact data is published for your domain. Email sent to the proxy
    /// email address is forwarded to the registrant's email address. Cloud Domains
    /// provides this privacy proxy service at no additional cost.
    PrivateContactData,
    /// Some data from `ContactSettings` is publicly available. The actual
    /// information redacted depends on the domain. For details, see [the
    /// registration privacy
    /// article](https://support.google.com/domains/answer/3251242).
    RedactedContactData,
    /// If set, the enum was initialized with an unknown value.
    ///
    /// Applications can examine the value using [ContactPrivacy::value] or
    /// [ContactPrivacy::name].
    UnknownValue(contact_privacy::UnknownValue),
}

#[doc(hidden)]
pub mod contact_privacy {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Clone, Debug, PartialEq)]
    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}

impl ContactPrivacy {
    /// Gets the enum value.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the string representation of enums.
    pub fn value(&self) -> std::option::Option<i32> {
        match self {
            Self::Unspecified => std::option::Option::Some(0),
            Self::PublicContactData => std::option::Option::Some(1),
            Self::PrivateContactData => std::option::Option::Some(2),
            Self::RedactedContactData => std::option::Option::Some(3),
            Self::UnknownValue(u) => u.0.value(),
        }
    }

    /// Gets the enum value as a string.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the integer representation of enums.
    pub fn name(&self) -> std::option::Option<&str> {
        match self {
            Self::Unspecified => std::option::Option::Some("CONTACT_PRIVACY_UNSPECIFIED"),
            Self::PublicContactData => std::option::Option::Some("PUBLIC_CONTACT_DATA"),
            Self::PrivateContactData => std::option::Option::Some("PRIVATE_CONTACT_DATA"),
            Self::RedactedContactData => std::option::Option::Some("REDACTED_CONTACT_DATA"),
            Self::UnknownValue(u) => u.0.name(),
        }
    }
}

impl std::default::Default for ContactPrivacy {
    fn default() -> Self {
        use std::convert::From;
        Self::from(0)
    }
}

impl std::fmt::Display for ContactPrivacy {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
        wkt::internal::display_enum(f, self.name(), self.value())
    }
}

impl std::convert::From<i32> for ContactPrivacy {
    fn from(value: i32) -> Self {
        match value {
            0 => Self::Unspecified,
            1 => Self::PublicContactData,
            2 => Self::PrivateContactData,
            3 => Self::RedactedContactData,
            _ => Self::UnknownValue(contact_privacy::UnknownValue(
                wkt::internal::UnknownEnumValue::Integer(value),
            )),
        }
    }
}

impl std::convert::From<&str> for ContactPrivacy {
    fn from(value: &str) -> Self {
        use std::string::ToString;
        match value {
            "CONTACT_PRIVACY_UNSPECIFIED" => Self::Unspecified,
            "PUBLIC_CONTACT_DATA" => Self::PublicContactData,
            "PRIVATE_CONTACT_DATA" => Self::PrivateContactData,
            "REDACTED_CONTACT_DATA" => Self::RedactedContactData,
            _ => Self::UnknownValue(contact_privacy::UnknownValue(
                wkt::internal::UnknownEnumValue::String(value.to_string()),
            )),
        }
    }
}

impl serde::ser::Serialize for ContactPrivacy {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        match self {
            Self::Unspecified => serializer.serialize_i32(0),
            Self::PublicContactData => serializer.serialize_i32(1),
            Self::PrivateContactData => serializer.serialize_i32(2),
            Self::RedactedContactData => serializer.serialize_i32(3),
            Self::UnknownValue(u) => u.0.serialize(serializer),
        }
    }
}

impl<'de> serde::de::Deserialize<'de> for ContactPrivacy {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        deserializer.deserialize_any(wkt::internal::EnumVisitor::<ContactPrivacy>::new(
            ".google.cloud.domains.v1.ContactPrivacy",
        ))
    }
}

/// Notices about special properties of certain domains.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum DomainNotice {
    /// The notice is undefined.
    Unspecified,
    /// Indicates that the domain is preloaded on the HTTP Strict Transport
    /// Security list in browsers. Serving a website on such domain requires
    /// an SSL certificate. For details, see
    /// [how to get an SSL
    /// certificate](https://support.google.com/domains/answer/7638036).
    HstsPreloaded,
    /// If set, the enum was initialized with an unknown value.
    ///
    /// Applications can examine the value using [DomainNotice::value] or
    /// [DomainNotice::name].
    UnknownValue(domain_notice::UnknownValue),
}

#[doc(hidden)]
pub mod domain_notice {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Clone, Debug, PartialEq)]
    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}

impl DomainNotice {
    /// Gets the enum value.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the string representation of enums.
    pub fn value(&self) -> std::option::Option<i32> {
        match self {
            Self::Unspecified => std::option::Option::Some(0),
            Self::HstsPreloaded => std::option::Option::Some(1),
            Self::UnknownValue(u) => u.0.value(),
        }
    }

    /// Gets the enum value as a string.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the integer representation of enums.
    pub fn name(&self) -> std::option::Option<&str> {
        match self {
            Self::Unspecified => std::option::Option::Some("DOMAIN_NOTICE_UNSPECIFIED"),
            Self::HstsPreloaded => std::option::Option::Some("HSTS_PRELOADED"),
            Self::UnknownValue(u) => u.0.name(),
        }
    }
}

impl std::default::Default for DomainNotice {
    fn default() -> Self {
        use std::convert::From;
        Self::from(0)
    }
}

impl std::fmt::Display for DomainNotice {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
        wkt::internal::display_enum(f, self.name(), self.value())
    }
}

impl std::convert::From<i32> for DomainNotice {
    fn from(value: i32) -> Self {
        match value {
            0 => Self::Unspecified,
            1 => Self::HstsPreloaded,
            _ => Self::UnknownValue(domain_notice::UnknownValue(
                wkt::internal::UnknownEnumValue::Integer(value),
            )),
        }
    }
}

impl std::convert::From<&str> for DomainNotice {
    fn from(value: &str) -> Self {
        use std::string::ToString;
        match value {
            "DOMAIN_NOTICE_UNSPECIFIED" => Self::Unspecified,
            "HSTS_PRELOADED" => Self::HstsPreloaded,
            _ => Self::UnknownValue(domain_notice::UnknownValue(
                wkt::internal::UnknownEnumValue::String(value.to_string()),
            )),
        }
    }
}

impl serde::ser::Serialize for DomainNotice {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        match self {
            Self::Unspecified => serializer.serialize_i32(0),
            Self::HstsPreloaded => serializer.serialize_i32(1),
            Self::UnknownValue(u) => u.0.serialize(serializer),
        }
    }
}

impl<'de> serde::de::Deserialize<'de> for DomainNotice {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        deserializer.deserialize_any(wkt::internal::EnumVisitor::<DomainNotice>::new(
            ".google.cloud.domains.v1.DomainNotice",
        ))
    }
}

/// Notices related to contact information.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ContactNotice {
    /// The notice is undefined.
    Unspecified,
    /// Required when setting the `privacy` field of `ContactSettings` to
    /// `PUBLIC_CONTACT_DATA`, which exposes contact data publicly.
    PublicContactDataAcknowledgement,
    /// If set, the enum was initialized with an unknown value.
    ///
    /// Applications can examine the value using [ContactNotice::value] or
    /// [ContactNotice::name].
    UnknownValue(contact_notice::UnknownValue),
}

#[doc(hidden)]
pub mod contact_notice {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Clone, Debug, PartialEq)]
    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}

impl ContactNotice {
    /// Gets the enum value.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the string representation of enums.
    pub fn value(&self) -> std::option::Option<i32> {
        match self {
            Self::Unspecified => std::option::Option::Some(0),
            Self::PublicContactDataAcknowledgement => std::option::Option::Some(1),
            Self::UnknownValue(u) => u.0.value(),
        }
    }

    /// Gets the enum value as a string.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the integer representation of enums.
    pub fn name(&self) -> std::option::Option<&str> {
        match self {
            Self::Unspecified => std::option::Option::Some("CONTACT_NOTICE_UNSPECIFIED"),
            Self::PublicContactDataAcknowledgement => {
                std::option::Option::Some("PUBLIC_CONTACT_DATA_ACKNOWLEDGEMENT")
            }
            Self::UnknownValue(u) => u.0.name(),
        }
    }
}

impl std::default::Default for ContactNotice {
    fn default() -> Self {
        use std::convert::From;
        Self::from(0)
    }
}

impl std::fmt::Display for ContactNotice {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
        wkt::internal::display_enum(f, self.name(), self.value())
    }
}

impl std::convert::From<i32> for ContactNotice {
    fn from(value: i32) -> Self {
        match value {
            0 => Self::Unspecified,
            1 => Self::PublicContactDataAcknowledgement,
            _ => Self::UnknownValue(contact_notice::UnknownValue(
                wkt::internal::UnknownEnumValue::Integer(value),
            )),
        }
    }
}

impl std::convert::From<&str> for ContactNotice {
    fn from(value: &str) -> Self {
        use std::string::ToString;
        match value {
            "CONTACT_NOTICE_UNSPECIFIED" => Self::Unspecified,
            "PUBLIC_CONTACT_DATA_ACKNOWLEDGEMENT" => Self::PublicContactDataAcknowledgement,
            _ => Self::UnknownValue(contact_notice::UnknownValue(
                wkt::internal::UnknownEnumValue::String(value.to_string()),
            )),
        }
    }
}

impl serde::ser::Serialize for ContactNotice {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        match self {
            Self::Unspecified => serializer.serialize_i32(0),
            Self::PublicContactDataAcknowledgement => serializer.serialize_i32(1),
            Self::UnknownValue(u) => u.0.serialize(serializer),
        }
    }
}

impl<'de> serde::de::Deserialize<'de> for ContactNotice {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        deserializer.deserialize_any(wkt::internal::EnumVisitor::<ContactNotice>::new(
            ".google.cloud.domains.v1.ContactNotice",
        ))
    }
}

/// Possible states of a `Registration`'s transfer lock.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum TransferLockState {
    /// The state is unspecified.
    Unspecified,
    /// The domain is unlocked and can be transferred to another registrar.
    Unlocked,
    /// The domain is locked and cannot be transferred to another registrar.
    Locked,
    /// If set, the enum was initialized with an unknown value.
    ///
    /// Applications can examine the value using [TransferLockState::value] or
    /// [TransferLockState::name].
    UnknownValue(transfer_lock_state::UnknownValue),
}

#[doc(hidden)]
pub mod transfer_lock_state {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Clone, Debug, PartialEq)]
    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}

impl TransferLockState {
    /// Gets the enum value.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the string representation of enums.
    pub fn value(&self) -> std::option::Option<i32> {
        match self {
            Self::Unspecified => std::option::Option::Some(0),
            Self::Unlocked => std::option::Option::Some(1),
            Self::Locked => std::option::Option::Some(2),
            Self::UnknownValue(u) => u.0.value(),
        }
    }

    /// Gets the enum value as a string.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the integer representation of enums.
    pub fn name(&self) -> std::option::Option<&str> {
        match self {
            Self::Unspecified => std::option::Option::Some("TRANSFER_LOCK_STATE_UNSPECIFIED"),
            Self::Unlocked => std::option::Option::Some("UNLOCKED"),
            Self::Locked => std::option::Option::Some("LOCKED"),
            Self::UnknownValue(u) => u.0.name(),
        }
    }
}

impl std::default::Default for TransferLockState {
    fn default() -> Self {
        use std::convert::From;
        Self::from(0)
    }
}

impl std::fmt::Display for TransferLockState {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
        wkt::internal::display_enum(f, self.name(), self.value())
    }
}

impl std::convert::From<i32> for TransferLockState {
    fn from(value: i32) -> Self {
        match value {
            0 => Self::Unspecified,
            1 => Self::Unlocked,
            2 => Self::Locked,
            _ => Self::UnknownValue(transfer_lock_state::UnknownValue(
                wkt::internal::UnknownEnumValue::Integer(value),
            )),
        }
    }
}

impl std::convert::From<&str> for TransferLockState {
    fn from(value: &str) -> Self {
        use std::string::ToString;
        match value {
            "TRANSFER_LOCK_STATE_UNSPECIFIED" => Self::Unspecified,
            "UNLOCKED" => Self::Unlocked,
            "LOCKED" => Self::Locked,
            _ => Self::UnknownValue(transfer_lock_state::UnknownValue(
                wkt::internal::UnknownEnumValue::String(value.to_string()),
            )),
        }
    }
}

impl serde::ser::Serialize for TransferLockState {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        match self {
            Self::Unspecified => serializer.serialize_i32(0),
            Self::Unlocked => serializer.serialize_i32(1),
            Self::Locked => serializer.serialize_i32(2),
            Self::UnknownValue(u) => u.0.serialize(serializer),
        }
    }
}

impl<'de> serde::de::Deserialize<'de> for TransferLockState {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        deserializer.deserialize_any(wkt::internal::EnumVisitor::<TransferLockState>::new(
            ".google.cloud.domains.v1.TransferLockState",
        ))
    }
}
